package com.stylefeng.guns.modular.system.dao;

import com.stylefeng.guns.modular.system.model.Connection;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.stylefeng.guns.modular.vpn.vo.ConnectionBO;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Optional;

/**
 * @Description 在线
 * @Author Mr.God
 * @Date 2020-03-26 14:41
 **/
public interface ConnectionMapper extends BaseMapper<Connection> {
    List<ConnectionBO> findConnections(@Param("userName") String userName,
                                       @Param("start") Integer start,
                                       @Param("count") Integer count,
                                       @Param("serverType") Integer serverType);

    /**
     * 查询在线连接数量
     * @return
     */
    Long queryConnectCount(@Param("userName") String userName,@Param("serverType") Integer serverType);

    /**
     * 查询一个连接数据
     * @param id
     * @return
     */
    ConnectionBO queryOneConnect(@Param("id") Integer id);

    /**
     * 查询所有超过一天的连接
     * @return
     */
    List<ConnectionBO> queryMoreThanOneDayOfConnections();

}
